package Operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-12-31
 * Time: 22:14
 */
public class FindOperation implements Operation{
    @Override
    public void work(BookList book) {
        System.out.println("请输入要查找的数名");
        Scanner scanner=new Scanner(System.in);
        String name1=scanner.nextLine();
        int size=book.getUsedSize();
        for (int i = 0; i < size; i++) {
            if(name1.equals(book.getBook(i).getName())){
                System.out.println("找到了,信息如下:");
                System.out.println(book.getBook(i));
                return;

            }
        }
        System.out.println("该书不存在");

    }
}
